       IDENTIFICATION DIVISION.
       PROGRAM-ID.  envcheck.
      *  envcheck displays the existing COBOL-IT environment.
      *
      *  To compile: cobc -g -o .\object -t .\lst envcheck.cbl
      *  To run:     cobcrun envcheck
      * 
      *
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  env-scr-flds.
         05  ws-cobcpy           PIC X(35)       VALUE SPACES.
         05  ws-cobitopt         PIC X(45)       VALUE SPACES.
         05  ws-cob-error-file   PIC X(35)       VALUE SPACES.
         05  ws-cob-file-path    PIC X(35)       VALUE SPACES.
         05  ws-cob-dump         PIC X(35)       VALUE SPACES.     
         05  ws-cob-library-path PIC X(35)       VALUE SPACES.
         05  ws-cobolitdir       PIC X(35)       VALUE SPACES.
         05  ws-tmpdir           PIC X(35)       VALUE SPACES.
         05  ws-cob-file-trace   PIC X           VALUE SPACES.
         05  ws-dd1-reslist      PIC X(35)       VALUE SPACES.
         05  ws-dd2-reslist      PIC X(35)       VALUE SPACES.
         05  ws-reslist          PIC X(35)       VALUE SPACES.
         05  ws-cob-pre-load     PIC X(35)       VALUE SPACES.
         05  ws-cob-load-case    PIC X(35)       VALUE SPACES.
         05  ws-dummy            PIC X           VALUE SPACES.
      *
       SCREEN SECTION.
      *
       01 environment-screen.
         05  cobolit-environment-screen. 
           10  VALUE "YOUR COBOL-IT COMPILER ENVIRONMENT" 
                                                 ERASE EOS      
                                                 LINE 02 COL 5.
           10  VALUE "COBOLITDIR"                LINE 04 COL 5.
           10  scr-cobolitdir                    LINE 04 COL 25
                                  PIC X(35) FROM ws-cobolitdir.
           10  VALUE "COBITOPT"                  LINE 05 COL 5.
           10  scr-cobitopt                      LINE 05 COL 25
                                    PIC X(45) FROM ws-cobitopt.
           10  VALUE "COB_COPY_DIR"              LINE 06 COL 5.
           10  scr-cobcpy                        LINE 06 COL 25
                                     PIC X(35) FROM ws-cobcpy.
           10  VALUE "COB_FILE_TRACE"            LINE 07 COL 5.
           10  scr-tmpdir                        LINE 07 COL 25
                                     PIC X(35) FROM ws-tmpdir.
         05 runtime-environment-screen.
           10  VALUE "YOUR COBOL-IT RUNTIME ENVIRONMENT" 
                                                 LINE 10 COL 5.        
           10  VALUE "COB_LIBRARY_PATH"          LINE 12 COL 5.
           10  scr-cob-library-path              LINE 12 COL 25
                            PIC X(35) FROM ws-cob-library-path.
           10  VALUE "COB_ERROR_FILE"            LINE 13 COL 5.
           10  scr-cob-error-file                LINE 13 COL 25
                              PIC X(35) FROM ws-cob-error-file.
           10  VALUE "COB_DUMP"                  LINE 14 COL 5.
           10  scr-cob-dump                      LINE 14 COL 25
                                    PIC X(35) FROM ws-cob-dump.
           10  VALUE "COB_FILE_PATH"             LINE 15 COL 5.
           10  scr-cob-file-path                 LINE 15 COL 25
                               PIC X(35) FROM ws-cob-file-path.
           10  VALUE "DD_reslist"                LINE 16 COL 5.
           10  scr-dd1-reslist                   LINE 16 COL 25
                               PIC X(35) FROM ws-DD1-reslist.
           10  VALUE "dd_reslist"                LINE 17 COL 5.
           10  scr-dd2-reslist                   LINE 17 COL 25
                               PIC X(35) FROM ws-dd2-reslist.
           10  VALUE "reslist"                   LINE 18 COL 5.
           10  scr-reslist                       LINE 18 COL 25
                               PIC X(35) FROM ws-reslist.
           10  VALUE "COB_PRE_LOAD"              LINE 19 COL 5.
           10  scr-cob-pre-load                  LINE 19 COL 25
                               PIC X(35) FROM ws-cob-pre-load.
           10  VALUE "COB_LOAD_CASE"             LINE 20 COL 5.
           10  scr-cob-load-case                 LINE 20 COL 25
                               PIC X(35) FROM ws-cob-load-case.     
           10  VALUE                         "HIT ANY KEY to EXIT... "
                                                 LINE 24 COL 5.
           10  scr-update-flag                   AUTO
                                                 LINE 24 COL 32
                                                 PIC X USING ws-dummy.

      *

       PROCEDURE DIVISION.
       main.
           INITIALIZE env-scr-flds.
           PERFORM show-environment-screen.
      *     DISPLAY "Sample 1 Finished" upon syserr.
           STOP RUN.
      *
       show-environment-screen.
           PERFORM capture-existing-environment.
           DISPLAY environment-screen.

           ACCEPT environment-screen. 
      *
       capture-existing-environment.
           INITIALIZE env-scr-flds.                                         .
 
           ACCEPT ws-cobcpy FROM ENVIRONMENT "COB_COPY_DIR".
           ACCEPT ws-cobitopt FROM ENVIRONMENT "COBITOPT".
           ACCEPT ws-cob-error-file FROM ENVIRONMENT "COB_ERROR_FILE".
           ACCEPT ws-cob-dump FROM ENVIRONMENT "COB_DUMP".

           ACCEPT ws-cob-file-path FROM ENVIRONMENT "COB_FILE_PATH".
           ACCEPT ws-cob-library-path FROM ENVIRONMENT 
                                                   "COB_LIBRARY_PATH".
           ACCEPT ws-cobolitdir FROM ENVIRONMENT "COBOLITDIR".
           ACCEPT ws-cob-file-trace FROM ENVIRONMENT "COB_FILE_TRACE".
           ACCEPT ws-dd1-reslist FROM ENVIRONMENT "DD_reslist".
           ACCEPT ws-dd2-reslist FROM ENVIRONMENT "dd_reslist".
           ACCEPT ws-reslist FROM ENVIRONMENT "reslist".
           ACCEPT ws-cob-pre-load FROM ENVIRONMENT "COB_PRE_LOAD".
           ACCEPT ws-cob-load-case FROM ENVIRONMENT "COB_LOAD_CASE".
      *
